#pragma once

#include <unistd.h>
#include "watermark_common.h"
#include "WMarkConfig.h"
namespace android
{

    class WMarkBuffer
    {
    public:
        WMarkBuffer()
        {
            WMarkConfig *wmarkConfig = WMarkConfig::getInstance();
            mWidth = wmarkConfig->getWmarkImageWidth();
            mHeight = wmarkConfig->getWmarkImageHeight();
            mCapacity = mHeight * mWidth;

            mBuf = new uint8_t *[mWidth];
            for (int i = 0; i < mHeight; i++)
            {
                mBuf[i] = new uint8_t[mWidth];
            }
        }

        ~WMarkBuffer()
        {
            mCapacity = 0;
            if (mBuf) {
                for (int i = 0; i < mHeight; i++)
                {
                    delete mBuf[i];
                    mBuf[i] = NULL;
                }
                delete mBuf;
                mBuf = NULL;
            }
        }

        int getCapacity() { return mCapacity; }
        int getSize() { return mSize; }
        void setSize(int size) { mSize = size; }
        uint8_t **Data() { return mBuf; }
        int getDataWidth() { return mWidth; }
        int getDataHeight() { return mHeight; }

    private:
        uint8_t **mBuf;
        int mCapacity;
        int mSize;
        int mWidth;
        int mHeight;

    public:
        int displayX;
        int displayY;
        int cameraId;
        int enableWmark;
    };
} //namespace
